<%--
  @desc:普通商户登录认证
  @author: chenw
  @create: 14-2-10 下午5:09
--%>
<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="keywords" content="keywords"/>
    <meta name="description" content="description"/>
    <title>用户登录</title>
    <link rel="stylesheet" type="text/css" href="<c:url value='/resource/css/profile-login.css'/>"/>
    <style type="text/css">
        .download a {
            padding-left: 5px;
            font-size: 14px;
            font-weight: normal;
            color: #555;
            text-decoration: none;
            letter-spacing: 1px
        }
        .download a:hover {
            text-decoration: underline;
            color: #36F
        }
        .download span {
            float: right
        }
        #error-msg {
            color: #ff4d2f;
            margin-left: 20px;
        }
    </style>
</head>
<body>
<div class="main">
    <div class="header"><span style="font-size: 45px;font-weight: bold;color:white;">监控平台</span></div>
    <div class="content">
        <div class="title hide">管理登录</div>
        <div>
            <fieldset>
                <div class="input">
                    <input class="input_all name" id="txt_login_id" name="loginId" placeholder="用户名" type="text" onFocus="this.className='input_all name_now';"
                            onBlur="this.className='input_all name'" maxLength="24"/>
                </div>
                <div class="input">
                    <input class="input_all password" id="txt_pwd" name="password" type="password" placeholder="密码" onFocus="this.className='input_all password_now';"
                            onBlur="this.className='input_all password'" maxLength="24"/>
                </div>
                <div class="checkbox">
                    <%--<input type="checkbox" name="remember" id="remember"/><label for="remember"><span>记住密码</span></label> --%><span id="error-msg"></span>
                </div>
                <div class="enter">
                    <input id="btn-login" class="button hide" type="button" value="登录"/>
                </div>
            </fieldset>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="<c:url value='/resource/js/jquery-1.8.3.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resource/js/placeholder.js'/>"></script>
<!--[if IE 6]>
<script type="text/javascript" src="<c:url value='/resource/js/belatedpng.js'/>"></script>
<script type="text/javascript">
    DD_belatedPNG.fix("*");
</script><![endif]-->
<script type="text/javascript">
    $(function () {
        //用户登录
        $("#btn-login").click(function () {
            submitForm();
        });
        document.onkeydown = function (event) {
            var e = event || window.event || arguments.callee.caller.arguments[0];
            if (e && e.keyCode == 13) {
                submitForm();
            }
        };
        function submitForm() {
            var _name = $.trim($("#txt_login_id").val()), _pwd = $.trim($("#txt_pwd").val());
            if (_name.length == 0) {
                $("#error-msg").text("请输入登录名");
                return;
            }
            if (_pwd.length == 0) {
                $("#error-msg").text("请输入密码");
                return;
            }
            $("#error-msg").text("");
            $.ajax({
                url: "<c:url value='/profile/auth'/>",
                type: "post",
                async: false,
                dataType: "json",
                data: "loginId=" + _name + "&password=" + _pwd,
                success: function (resp) {
                    if (resp && resp.succ) {
                        window.location.replace("<c:url value='/profile/index'/>");
                    } else {
                     $("#error-msg").html(resp.msg);

                       return false;
                    }
                }

            });
        }
    });
</script>
</html>